package org.spring.boot.sample.profile.controller;

import org.spring.boot.sample.profile.config.WebConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Profile("prod")
public class IndexController {

	@Autowired
	private WebConfig webConfig;
	
	@Value("${name}")
	private String name;
	
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public String hello() {
		return webConfig.getYearhope();
	}
	
	@RequestMapping(value = "name", method = RequestMethod.GET)
	public String name() {
		return name;
	}
}
